home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / SFLI10.ZIP / SFLI.DOC < prev    next >
Encoding:
Text File  |  1996-02-19  |  7.9 KB  |  220 lines

  1. SFLI FLI playing routine v1.0
  2. (c) 1996 SHAi'TAN
  3.  
  4. Index
  5.  
  6. 1.0     Introduction
  7. 1.1     Disclaimer
  8. 1.2     Other interesting things
  9.  
  10. 2.0     Basic usage
  11.  
  12. 3.0     The FLI File
  13. 3.1     Header
  14. 3.2     Frames 
  15. 3.3     Chunks
  16.  
  17. 4.0     The Chunks
  18. 4.1     Palette
  19. 4.2     Copy
  20. 4.3     Black
  21. 4.4     Byte-wise runlength
  22. 4.5     Line-compression
  23.  
  24. 5.0     Techniques used(not many...)
  25. 5.1     Timer
  26. 5.2     Buffers
  27.  
  28. 6.0     Everything else
  29. 6.1     Contacting me
  30. ────────────────────────────────────────────────────────────────────────────────
  31.  
  32.  
  33. 1.0     Introduction
  34.  
  35. As you might have figured out this is a routine for playing FLI files. As I
  36. hate writing dox i'll keep'em short...and since i'm not from England
  37. (fortunately...=)...) all linguistic errors are excused. The only thing
  38. (apart from the amazing fades) that differs this viewer from all the others
  39. is that you have all the source code(100% unreadable asm...)...
  40. To compile the code you need Turbo Assembler...version 3.1 works just fine...
  41.  
  42. 1.1     Disclaimer
  43.  
  44. I exclude any and all warranties, including warranties of merchantability and
  45. fitness for use of this code. This includes, but does not limit to, any
  46. damages to the equipment(and the person using it, including your wife,
  47. children, dog and/or sister/borther...=).
  48. Further, this code is for PRIVATE use only. For commercial use please contact
  49. me. This code is also FREE, which means that you may not sell it for profit.
  50. Neither may it be distributed within another package, that is not FREE.
  51. If this code is altered or used in another package, I must be credited for it.
  52.  
  53. For those of you that don't understand:
  54.  
  55. If you fuck up, it's your problem, not mine. If you try to sell this code,
  56. or use it in your totally amazing commercial or shareware game, you're
  57. breaking the law. If you modify or use the code in one or your free packages,
  58. put my name somewhere where everybody can see it.
  59. And remember: stealing code is LAME...
  60.  
  61. 1.2     Other interesting things
  62.  
  63. If you find any use for the code, please drop me an e-mail. If you find it
  64. completely useless, send the e-mail anyway. And since we're at it, if you
  65. ever do something in ASM/C/C++, send me a copy of it...it's us REAL
  66. coders against microsoft...so why don't we help eachother...=)
  67. ────────────────────────────────────────────────────────────────────────────────
  68.  
  69. 2.0     Basic Usage (This part is in case of future updates...)
  70.  
  71. Uhm...haven't ye figured it out yet?
  72. ────────────────────────────────────────────────────────────────────────────────
  73.  
  74. 3.0     The FLI File
  75.  
  76. The FLI File begins with a header. Then come the frames, which are divided
  77. into chunks. Each frame and chunk have a header. Almost all data is compressed,
  78. which improves viewing speed, while making the animation smaller(good if
  79. you only have 1Gb of HD space...)
  80.  
  81. 3.1     Header
  82.  
  83. The header contains info about the FLI(Things like size,num_of_frames and so
  84. on). It is 128 bytes long.
  85.  
  86. The Header:
  87.  
  88. Size    Name    Description
  89.  
  90. DWORD   size    Total size of the FLI file(Header included)...good if ye
  91.                 wanna pre-load it into memory.
  92. WORD    magic   ALWAYS 0AF11h for 320*200*256 standard FLI files.
  93. WORD    frames  Number of frames in FLI, max 4000.
  94. WORD    width   FLI width (320).
  95. WORD    height  FLI height (200).
  96. WORD    depth   Number of bits/pixel (8).
  97. WORD    flags   Should be 0.
  98. WORD    speed   Number of video ticks(approx 70th's of a second) between
  99.                 frames.
  100. DWORD   next    Dunno...should be 0.
  101. DWORD   frit    Dunno...should be 0.
  102. 102 BYTE expand Future expansion space.
  103.  
  104. 3.2     Frames
  105.  
  106. The frame is divided into chunks, each chunk containing different data. The
  107. frame is divided into a 16-byte header and the the chunks themselves.
  108.  
  109. The Frame:
  110.  
  111. DWORD   size    Total size of this frame(Frame header included). Should be
  112.                 less than 64K(to fit in one SEG) for normal FLI files.
  113. WORD    magic   ALWAYS 0F1FA.
  114. WORD    chunks  Number of chunks in this frames.
  115. 8 BYTE  expand  Future expansion space.
  116. ?       data    Frame data.
  117.  
  118. 3.3     Chunks
  119.  
  120. The chunks are the data itself. Each chunk has a 6-byte header. There are
  121. five types of chunks, as described below.
  122.  
  123. The Chunk:
  124.  
  125. DWORD   size    The size of this chunk(chunk header included).
  126. WORD    type    The chunk type(see part 4).
  127. ?       data    Chunk data.
  128. ────────────────────────────────────────────────────────────────────────────────
  129.  
  130. 4.0     The Chunks
  131.  
  132. There are 5 types of chunks, each having a different function...check the
  133. source to find out more about them...(this is getting boring....)
  134.  
  135. 4.1     Palette
  136.  
  137. FLI_COLOR
  138. Compressed palette chunk...check the source...
  139. [section incomplete]
  140.  
  141. 4.2     Copy
  142.  
  143. FLI_COPY
  144. 64000 bytes of uncompressed data to be copied to the screen. Very easy.
  145.  
  146. 4.3     Black
  147.  
  148. FLI_BLACK
  149. No data in this one...simply clear the video mem...
  150.  
  151. 4.4     Bytewise Run-length
  152.  
  153. FLI_BRUN
  154. Compressed data...check the source...
  155. [section incomplete]
  156.  
  157. 4.5     Line-Comperssion
  158.  
  159. FLI_LC
  160. Compressed data. Similar to FLI_BRUN...check the source...
  161. [section incomplete]
  162. ────────────────────────────────────────────────────────────────────────────────
  163.  
  164. 5.0     Techiniques
  165.  
  166. In this routine, i use some fairly simple techs, like buffering and interrupts.
  167. Thanx to Dreaden / VLA for his nice ASM TSR tute...
  168. Remember that the code needs a 386 to run...this is not because i use protected
  169. mode or something like that, but i use the FS and GS segment registers, one
  170. for each buffer...
  171.  
  172. 5.1     Timer
  173.  
  174. I needed something to generate an interrupt 70 times/sec(for correct video
  175. timing). Easiest way is to use the INT 1Ah interrupt. The only problem
  176. is that that interrupt is generated approx 18.2 times/second. Fortunately,
  177. the rate can be changed by messing with the 8253 PIT hardware(see PCGPE for
  178. info about that one...). What i want is to make it tick 70 times/second.
  179. Writing the magic bytes to the right port accomplishes that, but leaves
  180. one nasty problem...the INT 1Ah is called by the INT 08 routine...which
  181. also handles the clock. So if we increase the ticking, the clock will go
  182. crazy. Solution: We use the INT 08 interrupt instead, and update the clock
  183. only when needed. So...we setup the PIT to tick(generate INT 08) 70 times/
  184. second...but unfortunately, 70 isn't dividable by 18(normal speed...remeber?)
  185. and since we can't use floats(way too slow...), we increase the tick speed
  186. to the least common multiple of 70 and 18(630), and utdate the clock every
  187. 35:th tick and the video timer counter every 9:th tick...simple!
  188.  
  189. 5.2     Buffers
  190.  
  191. In this program, i used two buffers. One for a copy of the video memory, so
  192. all can be prepared during timing and then simply copied onto the screen.
  193. The second one was a data buffer, where the chunk data was loaded, before
  194. decompessing. The time gained by this is the time for the HD to seek each
  195. byte as it is needed.
  196. ────────────────────────────────────────────────────────────────────────────────
  197.  
  198. 6.0     Everything else
  199.  
  200. As you may have noticed, the chunk descs were incomplete...i might
  201. update the dox later on...and the fli player too...
  202. If you want more info about the FLI file, check out PCGPE found at
  203. x2ftp.oulu.fi. There are tonnes of useful programming info there.
  204. Also check the Hornet Archive at ftp.luth.se/pub/msdos/demo (mirror of
  205. ftp.cdrom.com) for info on gfx/sound programming and demos.
  206.  
  207. 6.1     Contacting me
  208.  
  209. If ye wanna contact me for some reason, the easiest way is to e-mail me at
  210. shaitan@proxxi.uf.se. It's always nice to get to know other coders out there,
  211. so if you have made something, send me a copy of the source. If you wanna
  212. finance a pizza/coke for me, don't unless it's more than 10$...i'm sure you
  213. can spend the money better than me...note; this applies only to private users.
  214. If you wanna use the code for commercial purposes(like shop-windows or games)
  215. you must register the program. Send me an e-mail to get a registration form.
  216.  
  217.                              -=SHAi'TAN '96=-
  218.  
  219.  
  220.